/** 
 * @description: 优化代码量
 * @fileName: generalProbability.js 
 * @author: 袁室祥 
 * @date: 2022-07-05 20:24:26
 * @后台人员:  
 */
function oneClickDraw(dom, span, border, i, flag) { //外层dom,图片spanUrl，边缘彩光盒子border，index，类型
    let random = parseInt(Math.random() * 1000)
    setTimeout(() => {
        dom.style.transition = 'all 2s';
        dom.style.transform = 'rotateY(' + 180 + 'deg)';

    }, 500)
    setTimeout(() => {
        border.style.display = 'flex'
        span.style.display = 'flex'
        if (a >= 70) {
            if (flag === '一键抽奖') {
                if (conArr.indexOf(i) == -1) {
                    cardStyle(arr[0], span, border, classList, 'orange')
                    a = 0
                }
            } else {
                cardStyle(arr[0], span, border, classList, 'orange')
                a = 0
            }

        } else if (b >= 35) {
            if (flag === '一键抽奖') {
                if (conArr.indexOf(i) == -1) {
                    cardStyle(arr[1], span, border, classList, 'purple')
                    b = 0
                }
            } else {
                cardStyle(arr[1], span, border, classList, 'purple')
                b = 0
            }


        } else if (c >= 21) {
            if (flag === '一键抽奖') {
                if (conArr.indexOf(i) == -1) {
                    cardStyle(arr[2], span, border, classList, 'blue')
                    c = 0
                }
            } else {
                cardStyle(arr[2], span, border, classList, 'blue')
                c = 0
            }

        } else {
            if (random > 0 && random <= 10) {
                if (a < 49) {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[6], span, border, classList, 'grey')
                        }
                    } else {
                        cardStyle(arr[6], span, border, classList, 'grey')
                    }

                } else {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[0], span, border, classList, 'orange')
                        }
                    } else {
                        cardStyle(arr[0], span, border, classList, 'orange')
                    }

                }
            }
            if (random > 10 && random <= 30) {
                if (b < 21) {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[5], span, border, classList, 'grey')
                        }
                    } else {
                        cardStyle(arr[5], span, border, classList, 'grey')
                    }

                } else {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[1], span, border, classList, 'purple')
                        }
                    } else {
                        cardStyle(arr[1], span, border, classList, 'purple')
                    }

                }
            }
            if (random > 30 && random <= 100) {
                if (c < 14) {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[5], span, border, classList, 'grey')
                        }
                    } else {
                        cardStyle(arr[5], span, border, classList, 'grey')
                    }

                } else {
                    if (flag === '一键抽奖') {
                        if (conArr.indexOf(i) == -1) {
                            cardStyle(arr[2], span, border, classList, 'blue')
                        }
                    } else {
                        cardStyle(arr[2], span, border, classList, 'blue')
                    }

                }
            }
            if (random > 100 && random <= 200) {
                if (flag === '一键抽奖') {
                    if (conArr.indexOf(i) == -1) {
                        cardStyle(arr[3], span, border, classList, 'green')
                    }
                } else {
                    cardStyle(arr[3], span, border, classList, 'green')
                }

            }
            if (random > 200 && random <= 350) {
                if (flag === '一键抽奖') {
                    if (conArr.indexOf(i) == -1) {
                        cardStyle(arr[4], span, border, classList, 'green')
                    }
                } else {
                    cardStyle(arr[4], span, border, classList, 'green')
                }

            }
            if (random > 350 && random <= 550) {
                if (flag === '一键抽奖') {
                    if (conArr.indexOf(i) == -1) {
                        cardStyle(arr[5], span, border, classList, 'grey')
                    }
                } else {
                    cardStyle(arr[5], span, border, classList, 'grey')
                }

            }
            if (random > 550 && random <= 1000) {
                if (flag === '一键抽奖') {
                    if (conArr.indexOf(i) == -1) {
                        cardStyle(arr[6], span, border, classList, 'grey')
                    }
                } else {
                    cardStyle(arr[6], span, border, classList, 'grey')
                }

            }
        }
        console.log(p[i], 'ppppp')
        p[i].style.display = 'none'
        if (flag === '一键抽奖') {
            setTimeout(() => {
                ck = false
                conArr = []
            }, 800)
            all = true
        }
    }, 1100);
}